<?php

use yii\web\Application;
use source\libs\Common;

defined('DS') or define('DS',DIRECTORY_SEPARATOR);
defined('INSTALL_APP_PATH') or define('INSTALL_APP_PATH',__DIR__);
defined('WEB_APP_ROOT') or define('WEB_APP_ROOT',dirname(__DIR__));

// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require (WEB_APP_ROOT .DS . 'vendor'.DS.'autoload.php');
require (WEB_APP_ROOT .DS .'vendor'.DS.'yiisoft'.DS.'yii2'.DS.'Yii.php');

require (WEB_APP_ROOT . DS .'source'.DS.'override.php');

require (WEB_APP_ROOT . DS .'data'.DS.'config'.DS.'bootstrap.php');
require (WEB_APP_ROOT . DS .'install'.DS.'config'.DS.'bootstrap.php');


$config = yii\helpers\ArrayHelper::merge(
    require(WEB_APP_ROOT . DS.'data'.DS.'config'.DS.'main.php'),
    require(WEB_APP_ROOT . DS .'data'.DS.'config'.DS.'main-local.php'),
    require(WEB_APP_ROOT . DS.'install'.DS.'config'.DS.'main.php'),
    require(WEB_APP_ROOT . DS.'install'.DS.'config'.DS.'main-local.php')
);
$config['components']['db']['class']='yii\\db\\Connection';
$app = new Application($config);

return $app ;